home *** CD-ROM | disk | FTP | other *** search
/ NeXT Enterprise Objects Framework 1.1 / NeXT Enterprise Objects Framework 1.1.iso / NextDeveloper / Headers / foundation / NSAutoreleasePool.h < prev    next >
Encoding:
Text File  |  1994-05-26  |  2.0 KB  |  43 lines

  1. /*    NSAutoreleasePool.h
  2.     Autoreleasing
  3.       Copyright 1993, 1994, NeXT, Inc.
  4.     NeXT, March 1993
  5. */
  6.  
  7. #import <foundation/NSObject.h>
  8.  
  9. /***************    Autorelease pool        ***************/
  10.  
  11. /* New pools are created and freed using the usual idioms (alloc/init and release).  When freed, the pool releases all the object in it (added with addObject:).  Autorelease pools are automatically associated with a thread.  Each newly created pool is 'stacked' in the current pool for that thread.  A pool that is in the middle of the stack that is freed causes every other pool higher in the stack to be released and diassociated with the stack.  This can happen if an execption breaks the normal allocation-release pairing without requiring explicit exception handler code for the release. */
  12.  
  13. @interface NSAutoreleasePool:NSObject {
  14.     /* Should not be subclassed (because of optimized allocation) */
  15.     @private
  16.     unsigned        lastStack;
  17.     NSAutoreleasePool    *parentPool;
  18.     unsigned        countToBeReleased;
  19.     unsigned        maxToBeReleased;
  20.     id            *toBeFreed;
  21. }
  22.  
  23. + (void)addObject:anObject;
  24.     /* Notes that anObject should be released when the pool at the current top of the stack is freed */
  25.  
  26. - (void)addObject:anObject;
  27.     /* Notes that anObject must be released when pool is freed */
  28.  
  29. + (void)enableDoubleReleaseCheck:(BOOL)enable;
  30.     /* When enabled, -release and -autorelease calls are checking whether this object has been released too many times.  This is done by searching all the pools, and makes programs run very slowly;
  31.     It is off by default */
  32.     
  33. + (void)enableRelease:(BOOL)enable;
  34.     /* When disabled, nothing added to pools is really released;  This makes your VM grow ...
  35.     By default release is enabled */
  36.  
  37. + (void)setPoolCountThreshhold:(unsigned)thrash;
  38.     /* Useful to investigate why so many things are autoreleased;
  39.     When enabled and the pool reaches a multiple of trash it will call a well-known method (indicated in the console).  Under the debugger, break on that method if you want to investigate; use 0 to disable;
  40.     By default release is disabled */
  41.  
  42. @end
  43.